#include <stdio.h>
#include "syscall.h"

extern "C" int read(int file, char *ptr, int len)
{
	int ret;
	__asm__ __volatile__(
		"int $0x90\t\n"
		"movl %%eax, %0"
		:"=m"(ret)
		:"a"(SYSCALL_READ), "b"(file), "c"(ptr), "d"(len)
	);

	return ret;
}

/*
const char * input = "1\n2\n3\n4\n5\n6\n\n7\n8\n9\n";
const char * cur = input;

extern "C" int read(int file, char *ptr, int len)
{
printf("LIBC: read(%d, 0x%x, 0x%x)\n", file, ptr, len);

	ptr[0] = *cur;
	cur++;
	return 1;
}
*/
